Happy Git and Hithub for the useR
Session 03 - Early Github Wins

Boook club R-Ladies Bergen, R-Ladies Den Bosch, R-Ladies Amsterdam

Book by Jenny, presentation by Martine

Some house rules

  • R-Ladies is dedicated to providing a harassment-free experience for everyone
  • We do not tolerate harassment of participants in any form
  • See the code of conduct

Program for today

  • Get started with GitHub
    • 15 New project, GitHub first
    • 16 Existing project, GitHub first
    • 17 Existing project, GitHub last
    • 18 Test drive R Markdown
    • 19 Render an R script
  • Git fundamentals?

Get started with GitHub

  • New project? Easiest way: GitHub first
  • Existing project?
    • GitHub first: pragmatic
    • GitHub last: more proper way to connect, especially if already a Git history

New project? Easiest way: GitHub first - Why?

  • Also sets up local Git repo for immediate pulling and pushing
  • Under the hood, we are doing git clone
  • The remote GitHub repo is configured as the origin remote for your local repo and your local main branch is now tracking the main on GitHub

New project? Easiest way: GitHub first - Steps 1/n

  • Make a repo on GitHub
  • Click the big green “<> Code” button, and copy a clone URL to your clipboard

New project? Easiest way: GitHub first - Steps 2/n

  • Make a new RStudio Project preferably via (run in any RConsole / R session):
usethis::create_from_github(
  repo_spec = "https://github.com/YOU/YOUR_REPO.git",
  destdir = "~/path/to/where/you/want/the/local/repo/"
)
  • This creates a new local directory in destdir, which is:
    • a directory or folder on your computer
    • a Git repository, linked to a remote GitHub repository
    • an RStudio Project
  • This opens a new RStudio instance in the new Project
  • In the absence of other constraints, Jenny suggest that all of your R projects have exactly this set-up.

New project? Easiest way: GitHub first - work, save & commit

  • Work on project, then click on Git tab:
  • Open commit screen by click on Commit button in git menu:

  • check boxes of things you like to commit
  • add a commit message
  • hit commit button at bottom

The end of session 3!